﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StateMain.aspx.cs" Inherits="Pages_StateMain" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="gdvState" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="Code" DataSourceID="objState" 
            onrowcommand="gdvState_RowCommand1">
            <Columns>
                <asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" 
                    Visible="False" />
                <asp:BoundField DataField="Name" HeaderText="Nome" SortExpression="Name" />
                <asp:BoundField DataField="Acronym" HeaderText="Sigla" 
                    SortExpression="Acronym" />

                <asp:TemplateField> 
                    <ItemTemplate>
                        <asp:LinkButton runat= "server"  ID="lbDelete" CommandArgument='<%# Bind("CODE") %>' CommandName="Exclude" OnClientClick='javascript:return confirm("Confirma a exclusão deste estado ?")' > Excluir </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField> 
                    <ItemTemplate>
                        <asp:LinkButton runat= "server"  ID="lbUpdate" CommandArgument='<%# Bind("CODE") %>' CommandName="Update" > Corrigir </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="objState" runat="server" SelectMethod="GetStates" 
            TypeName="br.com.SistemaChamados.Controller.StateController">
        </asp:ObjectDataSource>
    
        <br />
        <br />
        <asp:HyperLink ID="hlInsert" runat="server" NavigateUrl="StateInsert.aspx">Cadastrar</asp:HyperLink>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:HyperLink ID="hlMain" runat="server">Menu principal</asp:HyperLink>
    
    </div>
    </form>
</body>
</html>
